{include file="public/header" /}
<body>


   

<div class="layui-fluid">
    <div class="layui-card" >
		<div class="layui-card-header">添加工具借还</div>
      

        <form class="layui-form" action="" id="form1" lay-filter="form1" style="padding-top:10px;">
            
            
<div class="layui-form-item" >
    <label class="layui-form-label">工具RFID号</label>
	<div class="layui-input-block" >
		


<input type="text" id="code" name="code"  autocomplete="off" value="" title="" class="layui-input">

<select name="rfidcomport" id="rfidcomport">
        <option value="1">COM1</option>
        <option value="2">COM2</option>
        <option value="3">COM3</option>
        <option value="4">COM4</option>
        <option value="5">COM5</option>
        <option value="6">COM6</option>
</select>


<OBJECT
          	id=TUHFReader18 
	  	codebase="UHFReader18Proj.ocx"
		classid="clsid:1187A369-7CFD-4949-AFFD-3CD615827DBD"
	  	width=0
	  	height=0
	  	align=center
	  	hspace=0
	  	vspace=0
		>
		</OBJECT>

		
<input type="button" value="连接设备"  onclick="connectrfid();">
<input type="button" value="读取设备" onclick="readrfid();">

<script>
    function connectrfid()
    {
        var rfidname=$("#rfidcomport").val();
      
      alert("尝试连接"+rfidname);
     
           var sum = TUHFReader18.Open(rfidname,5);
          if(sum=="00")
          {
               alert("失败");
          }
          else
          {
               alert(rfidname);
          }
       
        
    }
    
    function readrfid()
    {
          var rfidname=$("#rfidcomport").val();
         alert(3);
    }
</script>

	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


<div class="layui-form-item" >
    <label class="layui-form-label">工具名称</label>
	<div class="layui-input-block" >
		<input type="text" id="name" name="name" lay-verify="required" autocomplete="off" value="" title="" class="layui-input">

	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


<div class="layui-form-item" >
    <label class="layui-form-label">工具类型</label>
	<div class="layui-input-block" >
		<input type="text" id="type" name="type" lay-verify="required" autocomplete="off" value="" title="" class="layui-input">

	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


<div class="layui-form-item" >
    <label class="layui-form-label">借用数量</label>
	<div class="layui-input-block" >
		<input type="text" id="number" name="number" lay-verify="required" autocomplete="off" value="1" title="" class="layui-input">

	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


<div class="layui-form-item" >
    <label class="layui-form-label">借用时间</label>
	<div class="layui-input-block" >
		
<input type="text" class="layui-input" lay-verify="required" id=borrowingtime name=borrowingtime placeholder="" value="<?php  echo date("Y-m-d H:i:s"); ?>">
    <SCRIPT>
        layui.use(['laydate', 'jquery'], function(){
			var $ = layui.$
				,laydate = layui.laydate;
			laydate.render({
				elem: '#borrowingtime'
				,type: 'datetime'
			  });
		});
    </SCRIPT>


	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>


<div class="layui-form-item" >
    <label class="layui-form-label">借用人</label>
	<div class="layui-input-block" >
		<input type="text" id="borrower" name="borrower" lay-verify="required" autocomplete="off" value="<?php  echo session('username'); ?>" title="" class="layui-input">

	</div>
    <div class="layui-form-mid layui-word-aux"></div>
</div>



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="savedata">确认添加</button>
                </div>
            </div>
        </form>
          <script>
           {php} if(session('roleid')>5){ {/php}
            $("input[name='ispublic']").parent().parent().hide();
           {php}}{/php}
        </script>
    </div>

</div>

<script>
     
     
    $("#code").change(function(){
          //$(this).css("background-color","#FFFFCC");
          
         var myurl="getinfofromother_code?rfid="+$(this).val();
         $.ajax({
            type: "get",        // 请求方式
            url: myurl, // 请求路径
            dataType: "json",   // 预期返回一个 json 类型数据
            success: function (data) {   // data是形参名，代表返回的数据
                 
             $("#name").val('');
               
             $("#type").val('');
             
      
              
             $("#name").val(data.name);
               
             $("#type").val(data.type);
             
                
            }
        });

          

          
          
     });
      
   
    
    
</script>

  



      {include file="public/footer" /}
      <script>
			var uploadimgurl = "{:url('/comm/upload/uploadimg')}";
      </script>
      <script src="__SKIN__/js/jmzhfsconfiguploadform.js?v=1.222"></script>
  
      <script type="text/javascript">


            $(function () {
                  formsubmit('form1',"{$addurl}");
            });

			
		
			layui.use(['form', 'layer','element','jquery'], function(){
				var $ = layui.$
					,form = layui.form;

			});
			
	
      </script>
<style>

    /* 每列表单过多，防止窜行，缩小宽度 */
    .layui-form-label{
       padding: 9px 10px;
    }
    
</style> 
</body>


</html>